#ifndef CC3000_H
#define CC3000_H

#include "../../app_main/app_def.h"

#define SOCKET_INACTIVE_ERR -57


#define NUM_STATES 6
#define FIRST_STATE_LED_NUM 1
#define MAX_SSID_LEN        32

// CC3000 State Machine Definitions
enum cc3000StateEnum
{
    CC3000_UNINIT           = 0x01, // CC3000 Driver Uninitialized
    CC3000_INIT             = 0x02, // CC3000 Driver Initialized
    CC3000_ASSOC            = 0x04, // CC3000 Associated to AP
    CC3000_IP_ALLOC         = 0x08, // CC3000 has IP Address
    CC3000_SERVER_INIT      = 0x10, // CC3000 Server Initialized
    CC3000_CLIENT_CONNECTED = 0x20  // CC3000 Client Connected to Server
};



int ConnectUsingSSID(char * ssidName,char *ssidKey);
void SetupIPAddress (unsigned char ub, unsigned char mub, unsigned char mlb,unsigned char lb);
void setupLocalSocket(void);
void ConnectToServer(void);
void ConnectToServer(void);

int init_spi(void);
char *sendDriverPatch(unsigned long *Length);
char *sendBootLoaderPatch(unsigned long *Length);
char *sendWLFWPatch(unsigned long *Length);
long ReadWlanInterruptPin(void);
void WlanInterruptEnable(void);
void WlanInterruptDisable(void);
void WriteWlanPin( unsigned char val );
void CC3000_UsynchCallback(long lEventType, char * data, unsigned char length);
void unsolicicted_events_timer_init(void);
void unsolicicted_events_timer_disable(void);
int initDriver(void);
void StartFirstTimeConfig(void);
void closeLocalSocket(void);
void disconnectAll(void);

char isFTCSet(void);
void setFTCFlag(void);


// Machine State
char currentCC3000State(void);
void setCC3000MachineState(char stat);
void unsetCC3000MachineState(char stat);
void resetCC3000StateMachine(void);
char highestCC3000State(void);

tNetappIpconfigRetArgs * getCC3000Info(void);
#endif






